<?php defined('SYSPATH') or die('No direct script access');

abstract class Controller extends Kohana_Controller {
	
	/**
	 * @var array $_GET and $_POST conents
	 */
	protected $_data = array();
	
	/**
	 * @var string Message to the user
	 */
	protected $_message = '';
	
	public function before () {
		$this->_data = Validate::factory(array_merge($_GET, $_POST))
			->as_array();
		
		View::bind_global('message', $this->_message);
		
		return parent::before();
	}
	
	/**
	 * Get $_GET and $_POST data, even if it was not set
	 * 
	 * @param string $key
	 * @return mixed
	 */
	public function get_data ($key) {
		if (empty($this->_data[$key]))
			return FALSE;
		return $this->_data[$key];
	}
} 

?>